package headfirst.combined.djview;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JButton;

import java.awt.BorderLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class testInstrumento {

	private JFrame frame;
	private Instrumento bombo;
	
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					testInstrumento window = new testInstrumento();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
		
		

	    
	}

	/**
	 * Create the application.
	 */
	public testInstrumento() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 450, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
        bombo = new Instrumento("B",35,1);
        //bombo.start();
        bombo.setBpm(60);
        
        
        
		JButton btnPlay = new JButton("Play");
		btnPlay.addMouseListener(new MouseAdapter() {
			public void mousePressed(MouseEvent arg0) {
				bombo.iniciar();
			}
		});
		frame.getContentPane().add(btnPlay, BorderLayout.CENTER);
		
		JButton btnParar = new JButton("Parar");
		btnParar.addMouseListener(new MouseAdapter() {
			public void mousePressed(MouseEvent arg0) {
				bombo.parar();
			}
		});
		frame.getContentPane().add(btnParar, BorderLayout.SOUTH);
	}

}
